﻿using UnityEngine;
using System.Collections;

public class Dialog : MonoBehaviour {

    public GUIText textTarget;
    public string[] messages;
    private int i;

    void Start()
    {
        textTarget.text = messages[i];
    }
	void Update () 
    {
        if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
        {
            i++;

            if (i < messages.Length - 1)
                textTarget.text = messages[i];
            else
                Time.timeScale = 1;

            gameObject.SetActive(false);
            i++;
        }
	}
}
